package com.example.demo1.maper;

import com.example.demo1.model.User;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {

    @Select("select * from student where id = #{id}")
    User getUserById(@Param("id") Integer id);

    @Select("select * from student where userName = #{userName}")
    User getUserByUserName(@Param("userName") String userName);

    @Insert("insert into student (userName,passWord) values (#{userName},#{passWord})")
    int addUser(@Param("userName") String userName, @Param("passWord") String passWord);

    @Select("Select * From  student where userName=#{userName} AND passWord = #{passWord} ")
    User queryUser(@Param("userName") String userName, @Param("passWord") String passWord);
}
